package org.example.springioc01.config;


import org.example.springioc01.bean.Animal;
import org.springframework.beans.factory.DisposableBean;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;

import javax.security.auth.Destroyable;

@Configuration
public class AnimalConfig implements InitializingBean, DisposableBean {

    @Bean(initMethod = "initMethod01",destroyMethod = "destroyMethod")
    public Animal animal(){
        return new Animal();
    }

    @Override
    public void afterPropertiesSet() throws Exception {
        System.out.println("afterPropertiesSet");
    }

    @Override
    public void destroy() throws Exception {
        System.out.println("destroy");
    }
}
